/*
 * GaseousSolution.cpp
 *
 *  Created on: 28 May 2011
 *      Author: allan
 */

#include "GaseousSolution.h"

GaseousSolution::GaseousSolution() 
{}

GaseousSolution::GaseousSolution(const vector<string>& species) :
species(species)
{}

GaseousSolution::~GaseousSolution()
{}

const string GaseousSolution::GetName() const
{
	return "Gaseous";
}

const vector<string> GaseousSolution::GetSpecies() const
{
	return species;
}

const VectorXd GaseousSolution::MolarFractions(const VectorXd& n) const
{
	return n / n.sum();
}

const VectorXd GaseousSolution::Concentrations(const VectorXd& n) const
{
	return MolarFractions(n);
}

const VectorXd GaseousSolution::ActivityCoefficients(double T, double P, const VectorXd& n) const
{
	return P * FugacityCoefficients(T, P, n);
}

const VectorXd GaseousSolution::Activities(double T, double P, const VectorXd& n) const
{
	return MolarFractions(n).array() * ActivityCoefficients(T, P, n).array();
}

const VectorXd GaseousSolution::FugacityCoefficients(double T, double P, const VectorXd& n) const
{
	return VectorXd::Ones(n.rows()); // Fugacity coefficients are currently assumed ideal, e.g., gamma = 1
}

const VectorXd GaseousSolution::Fugacities(double T, double P, const VectorXd& n) const
{
	return P * MolarFractions(n).array() * FugacityCoefficients(T, P, n).array();
}
